<template>
  <footer class="footer" :style="{ display: dis }">
    <span class="todo-count"
      ><strong>{{ count }}</strong
      >剩余</span
    >
    <ul class="filters">
      <li>
        <a href="#/">全部</a>
      </li>
      <li>
        <a href="#/active">进行中</a>
      </li>
      <li>
        <a href="#/completed">已完成</a>
      </li>
    </ul>
    <!-- 有已完成的任务，才需要显示这个按钮 -->
    <button @click="clearDone" class="clear-completed">清除已完成</button>
  </footer>
</template>

<script>
export default {
  name: "FooterT",
  components: {},
  props: {
    todoList: {
      type: Array,
      require: true,
    },
  },
  data() {
    return {};
  },
  computed: {
    count() {
      return this.todoList.filter((it) => it.done).length;
    },
    dis() {
      return this.count > 0 ? "blcok" : "none";
    },
  },
  watch: {},
  created() {},
  methods: {
    clearDone() {
      // this.clearTodo();
      this.$emit("clearTodo");
    },
  },
};
</script>

<style scoped></style>
